package ru.tpu.osu.faces.dao;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.*;

@Entity
public class PublicMessage implements Serializable, Comparable<PublicMessage> {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 814211433520596246L;
	@Id
	@Temporal(value=TemporalType.TIMESTAMP)
	private Date sentDate;
	@Id
	@ManyToOne
	private User sender;
	@Id
	@ManyToOne
	private Group recieverGroup;
	@Column
	private String text;
	@Column
	private String theme;
	public Date getSentDate() {
		return sentDate;
	}
	public void setSentDate(Date sentDate) {
		this.sentDate = sentDate;
	}
	public User getSender() {
		return sender;
	}
	public void setSender(User sender) {
		this.sender = sender;
	}
	public Group getRecieverGroup() {
		return recieverGroup;
	}
	public void setRecieverGroup(Group reciever_group) {
		this.recieverGroup = reciever_group;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public String getTheme() {
		return theme;
	}
	public void setTheme(String theme) {
		this.theme = theme;
	}
	public int compareTo(PublicMessage o) {
		return getSentDate().compareTo(o.getSentDate());
	}
 
}
